//
//  musicViewController.m
//  LastTemp
//
//  Created by dllo on 15/4/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "musicViewController.h"
#import "MVViewController.h"
#import "FMViewController.h"
#import "SingerViewController.h"
#import "SongListViewController.h"
#import "LBView.h"
#import "AVSingleton.h"
#import "PHViewController.h"
#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
@interface musicViewController ()
@property(nonatomic, retain)UIImageView *imageView;
@end
@implementation musicViewController
- (void)dealloc
{
    [_imageView release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"k1"]];
    
    UIButton *button3 = [UIButton buttonWithType:UIButtonTypeSystem];
    button3.frame = CGRectMake(0, 64, self.view.frame.size.width / 3, self.view.frame.size.width / 3);
    [button3 setBackgroundImage:[UIImage imageNamed:@"MV"] forState:UIControlStateNormal];
    button3.layer.cornerRadius = self.view.frame.size.width / 6;
    button3.layer.masksToBounds = YES;
    [self.view addSubview:button3];
    [button3 addTarget:self action:@selector(MVClick:) forControlEvents:UIControlEventTouchUpInside];

    
    UIButton *button4 = [UIButton buttonWithType:UIButtonTypeSystem];
    button4.frame = CGRectMake(self.view.frame.size.width / 2, self.view.frame.size.height / 3 * 2, self.view.frame.size.width / 3, self.view.frame.size.width / 3);
    [button4 setBackgroundImage:[UIImage imageNamed:@"dian"] forState:UIControlStateNormal];
    button4.layer.cornerRadius = self.view.frame.size.width / 6;
    button4.layer.masksToBounds = YES;
    [button4 addTarget:self action:@selector(FMClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button4];
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeSystem];
    button1.frame = CGRectMake(self.view.frame.size.width / 2, self.view.frame.size.width / 4, self.view.frame.size.width / 2, self.view.frame.size.width / 2);
    button1.layer.cornerRadius = self.view.frame.size.width / 4;
    button1.layer.masksToBounds = YES;
    [button1 setBackgroundImage:[UIImage imageNamed:@"songList"] forState:UIControlStateNormal];
    [self.view addSubview:button1];
    [button1 addTarget:self action:@selector(songListClick:) forControlEvents:UIControlEventTouchUpInside];
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeSystem];
    button2.frame = CGRectMake(0, self.view.frame.size.height / 3 , self.view.frame.size.width / 2, self.view.frame.size.width / 2);
    button2.layer.cornerRadius = self.view.frame.size.width / 4;
    button2.layer.masksToBounds = YES;
    [self.view addSubview:button2];
    [button2 setBackgroundImage:[UIImage imageNamed:@"singer"] forState:UIControlStateNormal];
    [button2 addTarget:self action:@selector(singerClick:) forControlEvents:UIControlEventTouchUpInside];

    
//    LBView *MV = [[LBView alloc] initWithFrame:CGRectMake(30, 2 *(HEIGHT - 113) / 4, (WIDTH - 60) / 3 + (WIDTH - 60) / 12, (HEIGHT - 113) / 4)];
//    MV.myLabel.text = @"MV";
//    [MV.myButton setBackgroundImage:[UIImage imageNamed:@"1.jpg"] forState:UIControlStateNormal];
//    [MV.myButton addTarget:self action:@selector(MVClick:) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:MV];
//    [MV release];
//    
//    LBView *FM = [[LBView alloc] initWithFrame:CGRectMake(30 + (WIDTH - 60) / 3 + 3 *(WIDTH - 60) / 12, 2 *(HEIGHT - 113) / 4, (WIDTH - 60) / 3 + (WIDTH - 60) / 12, (HEIGHT - 113) / 4)];
//    FM.myLabel.text = @"电台";
//    [FM.myButton setBackgroundImage:[UIImage imageNamed:@"2.jpg"] forState:UIControlStateNormal];
//    [FM.myButton addTarget:self action:@selector(FMClick:) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:FM];
//    [FM release];
//    
//    LBView *singer = [[LBView alloc] initWithFrame:CGRectMake(30, 2 *(HEIGHT - 113) / 4 + (HEIGHT - 113) / 4, (WIDTH - 60) / 3 + (WIDTH - 60) / 12, (HEIGHT - 113) / 4)];
//    singer.myLabel.text = @"歌手";
//    [singer.myButton setBackgroundImage:[UIImage imageNamed:@"5.jpg"] forState:UIControlStateNormal];
//    [singer.myButton addTarget:self action:@selector(singerClick:) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:singer];
//    [singer release];
//    
//    LBView *songList = [[LBView alloc] initWithFrame:CGRectMake(30 + (WIDTH - 60) / 3 + 3 *(WIDTH - 60) / 12, 2 *(HEIGHT - 113) / 4 + (HEIGHT - 113) / 4, (WIDTH - 60) / 3 + (WIDTH - 60) / 12, (HEIGHT - 113) / 4)];
//    songList.myLabel.text = @"歌单";
//    [songList.myButton setBackgroundImage:[UIImage imageNamed:@"6.jpg"] forState:UIControlStateNormal];
//    [songList.myButton addTarget:self action:@selector(songListClick:) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:songList];
//    [songList release];
    
    // 翅膀动画
//    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 460, 375, 207)];
//    self.imageView.image = [UIImage imageNamed:@"m6.jpg"];
//    [self.view addSubview:self.imageView];
//    [self.imageView release];
//    
//    [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(change) userInfo:nil repeats:YES]; // 定时器
//    [self change];
}
//- (void)change{
//    CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
//    // 设置时间
//    [basicAnimation setDuration:5];
//    // 设置重复次数
//    [basicAnimation setRepeatCount:NSIntegerMax];
//    // 设置起始的缩放值
//    basicAnimation.fromValue = [NSNumber numberWithInt:1];
//    // 设置缩放结束时候的值
//    basicAnimation.toValue = [NSNumber numberWithInt:0];
//    // 给imageview添加动画
//    [self.imageView.layer addAnimation:basicAnimation forKey:@"basicAnimation"];
//}
#pragma mark 页面跳转
- (void)MVClick:(UIButton *)button{
    
    MVViewController *mvVC = [[MVViewController alloc] init];
    [self.navigationController pushViewController:mvVC animated:YES];
    [mvVC release];
}
- (void)FMClick:(UIButton *)button{
    FMViewController *fmVC = [[FMViewController alloc] init];
    [self.navigationController pushViewController:fmVC animated:YES];
    [fmVC release];
}
- (void)singerClick:(UIButton *)button{
//    SingerViewController *singerVC = [[SingerViewController alloc] init];
//    [self.navigationController pushViewController:singerVC animated:YES];
//    [singerVC release];
    PHViewController *phVC = [[PHViewController alloc] init];
    [self.navigationController pushViewController:phVC animated:YES];
    [phVC release];
    
    
    
    
}
- (void)songListClick:(UIButton *)button{
    SongListViewController *songListVC = [[SongListViewController alloc] init];
    [self.navigationController pushViewController:songListVC animated:YES];
    [songListVC release];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
